package cac.fenjian.resource.tsuser.service;

//import cac.common.MD5;
//import cac.common.MD5Utils;
import cac.fenjian.resource.TsUser.dto.TsUserDTO;
import cac.fenjian.resource.tsuser.dao.TsUserDao;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class TsUserServiceImpl implements TsUserService{
    @Autowired
    private TsUserDao tsUserDao;

    @Override
    public TsUserDTO checkUser(String account, String password) {

        TsUserDTO tsuser =tsUserDao.findByAccountAndPassword(account, DigestUtils.md5Hex(password));
        return tsuser;
    }
    @Override
    public Integer changePassword(String account, String password,String newPwd) {
        Integer tsuser =tsUserDao.changePassword(account, password,newPwd);
        return tsuser;
    }

    @Override
    public Integer searchOldPwd(String oldPwd, String account) {
        Integer tsuser =tsUserDao.searchOldPwd(oldPwd,account);
        return tsuser;
    }
    public HashMap getUserInfoByAccount(String account){
        return tsUserDao.getUserInfoByAccount(account);
    }
}
